﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Collections.Generic;
using System.Linq;
using System.Collections;

namespace Hydra.Shell.Implementations
{
    public class EventSinkCollection : Dictionary<uint, object>
    {
        private uint lastCookie;

        public uint Add(object o)
        {
            this.Add(++lastCookie, o);

            return lastCookie;
        }

        public void SetAt(uint cookie, object o)
        {
            this.Add(cookie, o);
        }

        public void Remove(object o)
        {
            var _enum = this.AsEnumerable<KeyValuePair<uint, object>>();
            var item = _enum.SingleOrDefault(e => e.Value == o);

            base.Remove(item.Key);
        }

        public void RemoveAt(uint p)
        {
            base.Remove(p);
        }
    }
}
